package com.mcptt.config;

import android.content.Context;
import android.os.RemoteException;

import com.cloudptt.api.product.log.Log;
import com.mcptt.db.op.AddrDbOperator;
import com.mcptt.db.op.CameraDbOperator;
import com.mcptt.db.op.ConfigFileDbOperator;
import com.mcptt.db.op.DbOperator;
import com.mcptt.db.op.GroupConfigFileDbOperator;
import com.mcptt.db.op.GroupMembsDbOperator;
import com.mcptt.db.op.HistoryDbOperator;
import com.mcptt.db.op.MapDbOperator;

public class DbOperatorManager
{
	public static final int DbOperator_Addr = 1;
	public static final int DbOperator_History = 2;
	public static final int DbOperator_GroupMembs = 3;

	private GroupConfigFileDbOperator groupConfigDbOperator = null;
	private ConfigFileDbOperator configDbOperator = null;

	private AddrDbOperator addrDbOperator = null;
	private GroupMembsDbOperator groupMembsDbOperator = null;
	private HistoryDbOperator historyDbOperator = null;
	
	private MapDbOperator mapDbOperator = null;
	
	private CameraDbOperator cameraDbOperator = null;
	
	private DbOperator dbOperator = null;



	public DbOperatorManager(Context ctx)
	{
		Log.debug(this.getClass(), "DbOperatorManager");
		this.configDbOperator = new ConfigFileDbOperator(ctx);
		this.groupConfigDbOperator = new GroupConfigFileDbOperator(ctx);

		this.dbOperator = new DbOperator(ctx);
		this.addrDbOperator = new AddrDbOperator(ctx);
		this.groupMembsDbOperator = new GroupMembsDbOperator(ctx);
		this.historyDbOperator = new HistoryDbOperator(ctx);
		this.mapDbOperator = new MapDbOperator(ctx);
		this.cameraDbOperator = new CameraDbOperator(ctx);
	}
	public void doExit()
	{
		groupMembsDbOperator.resetGrpMemCallState();
		
		groupMembsDbOperator = null;
		addrDbOperator = null;
		historyDbOperator = null;
		mapDbOperator = null;
		groupConfigDbOperator = null;
		configDbOperator = null;
		dbOperator = null;
	}

	public GroupConfigFileDbOperator getGroupConfigDbOperator()
	{
		return groupConfigDbOperator;
	}
	public ConfigFileDbOperator getConfigDbOperator()
	{
		return configDbOperator;
	}
	public DbOperator getDbOperator()
	{
		return dbOperator;
	}
	public AddrDbOperator getAddrDbOperator()
	{
		return addrDbOperator;
	}
	public GroupMembsDbOperator getGroupMembsDbOperator()
	{
		return groupMembsDbOperator;
	}
	public HistoryDbOperator getHistoryDbOperator()
	{
		return historyDbOperator;
	}
	public MapDbOperator getMapDbOperator() {
		return mapDbOperator;
	}
	public CameraDbOperator getCameraDbOperator() {
		return cameraDbOperator;
	}
}
